VERSION 5.00
Begin VB.Form frmSetupClient 
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   5820
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   5730
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5820
   ScaleWidth      =   5730
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame1 
      BackColor       =   &H00F7D9C2&
      Height          =   5175
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4815
      Begin VB.CheckBox chkOpt4 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   33
         Top             =   4440
         Width           =   195
      End
      Begin VB.CheckBox chkOpt3 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   31
         Top             =   4200
         Width           =   195
      End
      Begin VB.CheckBox chkOpt2 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   29
         Top             =   3960
         Width           =   195
      End
      Begin VB.CheckBox chkOpt1 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   27
         Top             =   3720
         Width           =   195
      End
      Begin VB.Frame Frame4 
         BackColor       =   &H00F7D9C2&
         Height          =   75
         Left            =   915
         TabIndex        =   25
         Top             =   3555
         Width           =   3615
      End
      Begin VB.CheckBox chkMan06 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   23
         Top             =   3120
         Width           =   195
      End
      Begin VB.CheckBox chkMan05 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   21
         Top             =   2880
         Width           =   195
      End
      Begin VB.CheckBox chkMan04 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   19
         Top             =   2640
         Width           =   195
      End
      Begin VB.Frame Frame3 
         BackColor       =   &H00F7D9C2&
         Height          =   75
         Left            =   960
         TabIndex        =   18
         Top             =   360
         Width           =   3615
      End
      Begin VB.CheckBox Check1 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   8
         Top             =   540
         Width           =   195
      End
      Begin VB.CheckBox Check2 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   7
         Top             =   780
         Width           =   195
      End
      Begin VB.CheckBox Check3 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   6
         Top             =   1020
         Width           =   195
      End
      Begin VB.CheckBox Check4 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   5
         Top             =   1260
         Width           =   195
      End
      Begin VB.Frame Frame2 
         BackColor       =   &H00F7D9C2&
         Height          =   75
         Left            =   960
         TabIndex        =   4
         Top             =   1680
         Width           =   3615
      End
      Begin VB.CheckBox Check5 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   3
         Top             =   1920
         Width           =   195
      End
      Begin VB.CheckBox Check6 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   2
         Top             =   2160
         Width           =   195
      End
      Begin VB.CheckBox Check7 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Check1"
         Height          =   195
         Left            =   720
         TabIndex        =   1
         Top             =   2400
         Width           =   195
      End
      Begin VB.Label Label17 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Use Consignee ID"
         Height          =   195
         Left            =   1020
         TabIndex        =   34
         Top             =   4440
         Width           =   2895
      End
      Begin VB.Label Label16 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Use Vendor Code"
         Height          =   195
         Left            =   1020
         TabIndex        =   32
         Top             =   4200
         Width           =   2895
      End
      Begin VB.Label Label15 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Use Branch (Customer)"
         Height          =   195
         Left            =   1020
         TabIndex        =   30
         Top             =   3960
         Width           =   2895
      End
      Begin VB.Label Label14 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Use ""Requested to"""
         Height          =   195
         Left            =   1020
         TabIndex        =   28
         Top             =   3720
         Width           =   2895
      End
      Begin VB.Label Label13 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Optional"
         Height          =   315
         Left            =   120
         TabIndex        =   26
         Top             =   3495
         Width           =   1215
      End
      Begin VB.Label Label12 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Make User as Default Salesman"
         Height          =   195
         Index           =   0
         Left            =   1020
         TabIndex        =   24
         Top             =   3120
         Width           =   2895
      End
      Begin VB.Label Label11 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Use Parent Company"
         Height          =   195
         Left            =   1020
         TabIndex        =   22
         Top             =   2880
         Width           =   2895
      End
      Begin VB.Label Label10 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Affect Commission to transactions"
         Height          =   195
         Left            =   1020
         TabIndex        =   20
         Top             =   2640
         Width           =   2895
      End
      Begin VB.Label Label1 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Security"
         Height          =   315
         Left            =   180
         TabIndex        =   17
         Top             =   240
         Width           =   1215
      End
      Begin VB.Label Label2 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Verify Modification of Credit Limit"
         Height          =   195
         Left            =   1020
         TabIndex        =   16
         Top             =   540
         Width           =   2895
      End
      Begin VB.Label Label3 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Verify Modification of Client Type"
         Height          =   195
         Left            =   1020
         TabIndex        =   15
         Top             =   780
         Width           =   2895
      End
      Begin VB.Label Label4 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Verify Modification of Parent Company"
         Height          =   195
         Left            =   1020
         TabIndex        =   14
         Top             =   1020
         Width           =   2895
      End
      Begin VB.Label Label5 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Verify Holding of Customer"
         Height          =   195
         Left            =   1020
         TabIndex        =   13
         Top             =   1260
         Width           =   2895
      End
      Begin VB.Label Label6 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Mandatory"
         Height          =   315
         Left            =   120
         TabIndex        =   12
         Top             =   1620
         Width           =   1215
      End
      Begin VB.Label Label7 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Always check Market Segment"
         Height          =   195
         Left            =   1020
         TabIndex        =   11
         Top             =   1920
         Width           =   2895
      End
      Begin VB.Label Label8 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Always check Product Division"
         Height          =   195
         Left            =   1020
         TabIndex        =   10
         Top             =   2160
         Width           =   2895
      End
      Begin VB.Label Label9 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Never Ask for Customer's Type"
         Height          =   195
         Left            =   1020
         TabIndex        =   9
         Top             =   2400
         Width           =   2895
      End
   End
End
Attribute VB_Name = "frmSetupClient"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Object variables





'Recordset variables
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Public sBit As String

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Sub SetDataValue()
    Me.chkMan04.Value = GetValue("CLNT_MAN_COMMISSION", 3)
    Me.chkMan05.Value = GetValue("CLNT_MAN_USEPARENTCOMPANY", 3)
    Me.chkMan06.Value = GetValue("CLNT_MAN_USERDFSMAN", 3)
    
    Me.chkOpt1.Value = GetValue("CLNT_OPT_REQUESTEDTO", 3)
    Me.chkOpt2.Value = GetValue("CLNT_OPT_BRANCH", 3)
    Me.chkOpt3.Value = GetValue("CLNT_OPT_VENDORCODE", 3)
    Me.chkOpt4.Value = GetValue("CLNT_OPT_CONSIGNEEID", 3)
    
End Sub

Sub SaveChanges()
Set rs = Nothing
Set rs = New ADODB.Recordset
rs.Open "select datepart(yy,getdate()) as dDate", cn, adOpenKeyset, adLockReadOnly

    SetValue "CLNT_MAN_COMMISSION", 3, chkMan04.Value
    SetValue "CLNT_MAN_USEPARENTCOMPANY", 3, chkMan05.Value
    SetValue "CLNT_MAN_USERDFSMAN", 3, chkMan06.Value
    
    SetValue "CLNT_OPT_REQUESTEDTO", 3, chkOpt1.Value
    SetValue "CLNT_OPT_BRANCH", 3, chkOpt2.Value
    SetValue "CLNT_OPT_VENDORCODE", 3, chkOpt3.Value
    SetValue "CLNT_OPT_CONSIGNEEID", 3, chkOpt4.Value
    
     cn.BeginTrans
        rsHeader.UpdateBatch adAffectAll
    cn.CommitTrans
    MsgBox "Record/s successfully saved.", vbInformation, "ComUnion"
    
End Sub
 
 'Close active window
Public Sub TBCloseWindow()
    Unload Me
End Sub

Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_Load()
    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'SS04'")
    
    Set rsHeader = New ADODB.Recordset
    

    If rsHeader.State <> adStateOpen Then
        OpenRecordset rsHeader, "*", "SYSTEM_OPTION"
        SetDataValue
    End If
    
    TBBitReload
End Sub

Private Sub Form_Unload(Cancel As Integer)
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    
    
    
    
    Set rsHeader = Nothing
    
    Set frmSetupUtil = Nothing
    
    lCloseWindow = True
    CloseMenuTab ITGLedgerMain
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    Set FrmName = Me
    BitVisible ITGLedgerMain.tbrMain, True, True
    sBit = "0000000100001000"
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
End Sub

'Save all changes
Public Sub TBSave()
       SaveChanges
End Sub


Public Function GetValue(param1 As String, param2 As Integer)
On Error GoTo TheSource
    lBoolean = True
    If rsHeader.RecordCount = 0 Then Exit Function
    rsHeader.MoveFirst
    rsHeader.Find ("cCode='" & param1 & "'")
    If param2 = 3 Then
        GetValue = IIf(rsHeader.Fields(3), 1, 0)
    Else
        GetValue = IIf(rsHeader.Fields(4) = Null, "", rsHeader.Fields(4))
    End If
    lBoolean = False
TheSource:
    If lBoolean Then
        If param2 = 3 Then GetValue = False
        If param2 = 4 Then GetValue = ""
    End If
End Function


Sub SetValue(param1 As String, param2 As Integer, param3 As String)
On Error GoTo TheSource
  
    If rsHeader.RecordCount = 0 Then Exit Sub
    rsHeader.MoveFirst
    rsHeader.Find ("cCode='" & param1 & "'")
    If param2 = 3 Then
        rsHeader.Fields(3).Value = IIf(param3 = "0", 0, 1)
    Else
        rsHeader.Fields(4).Value = param3
    End If
TheSource:
    Exit Sub
End Sub

